/*
 * @Author: xiaosihan 
 * @Date: 2023-06-30 00:57:01 
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2023-10-18 22:32:02
 */




import { ReactNode, useEffect, useRef, useState } from "react";
import { Breadcrumb, InputNumber, Layout, Menu, Button, Space } from 'antd';
import styles from "./index.module.less";
import clsx from "clsx";

interface Iprops {
    onChange: (value: number | null, name: string) => void;
    count: number;
    name: string;
}

// 红色按钮
export default function InputContrl({ onChange, count, name }: Iprops) {

    return (
        <Space.Compact size="small">
            <Button onClick={() => {
                if (count >= 1) {
                    onChange(count - 1, name);
                }
            }}>-</Button>
            <InputNumber
                style={{ width: 50, textAlign: 'center' }}
                min={0}
                value={count}
                className={styles.inputBox}
                onChange={(value: number | null) => { onChange(value, name) }}
                controls={false}
            />
            <Button onClick={() => { onChange(count + 1, name) }}>+</Button>
        </Space.Compact>

    );

}
